<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<%@ include file="html-header.jsp"%>
<style type="text/css">
<%@ include file="../stylesheets/main.css"%>
<%@ include file="../stylesheets/header.css"%>
<%@ include file="../stylesheets/footer.css"%>
<%@ include file="../stylesheets/carousel.css"%>
<%@ include file="../stylesheets/basket.css"%>
</style>
</head>
<body>
	<div id="left-column-outer">
		<div id="left-column"></div>
	</div>

	<div id="center-column">
		<div class="CenteredContainer">
			<img id="background_noresize" alt="background_noresize"
				src="/Browarex/img/background.jpg">
			<%@ include file="header.jsp"%>
			<div class="ContentShade"></div>
			<div class="ContentContainer">
				<table class="det" id="basketQueryResults">
					<tr>
						<td><span class="ProductTableDesc"><s:message
									code="label.basket" /></span></td>
					</tr>
					<c:forEach items="${productsList}" var="product" varStatus="loop">
						<tr>
							<td class="ImageCell">
							<img class="BeerImage" alt="Beer Image"
								src="getImage?imageId=${product.id}" /></td>
							<td class="TitleCell">
							<span class="ProductInfo Title">${product.productName}</span>
								<span class="ProductInfo Capacity">
									${product.product.capacity}l</span> <span class="ProductInfo">;
									${product.product.voltage}%</span> <br /> 
									<span class="ProductInfo Type"><s:message
										code="product.packageType" />${product.product.packageType.value}</span>
								</td>
							
									<td class="EditCell">
							<sf:form method="post" commandName="orderProductInfo"
								action="editBasket">
								<sf:hidden path="id"
									value="${product.id}" /> <sf:hidden path="product.id"
									value="${product.product.id}" />
								<input name="quantity" onclick="this.value='';"
									onfocus="this.select()"
									onblur="this.value=!this.value?'<s:message code="label.ilosc"/>':this.value;"
									value="${product.quantity }" class="LabelOrder" /> <input
									type="submit" value="<s:message code="button.editQuantity"/>"
									class="OrderButton">
									<c:if test="${product.id == orderProductInfo.id}">
										<sf:errors style="color: red; float: right;" path="product.quantity" />
									</c:if>
							</sf:form>
							<sf:form method="post" commandName="orderProductInfo"
								action="deleteItem">
								<sf:hidden path="id" value="${product.id}" />
								<input type="submit"
									value="<s:message code="button.deleteItem"/>">
							</sf:form>
							</td>
							<td class="PriceCell">
							<span class="ProductInfo PriceTitle"><s:message
										code="product.price" /></span><br/>
										<span class="ProductInfo Price">${product.stringPrice} <s:message
										code="label.PLN" /></span> </td>
						</tr>
						<tr class="TableBreak">
						<td colspan="4"><img style=" height: 7px; width: 965px;" alt="Cell Break" src="/Browarex/img/line.png"/></td></tr>
					</c:forEach>
					<c:if test="${not empty productsList}">
					<sf:form action="makeOrder" commandName="order" method="POST">
						<tr>
							<td colspan="2" class="OrderButtonCell">
								<input type="submit" value="<s:message code="button.zamow"/>">
							</td>
							<td class="SummaryCellTitle">
								<span class="BasketSummary"><s:message code="label.kosztZamowienia" /></span>
							</td>
							<td class="PriceCell">
								<span class="ProductInfo Price Summary">${price } <s:message code="label.PLN" /></span>		
								<c:if test="${discount > 0 }">
		           					<span class="ProductInfo"><s:message code="label.znizka" /> ${discount } %</span>
	           					</c:if>					
							</td>
						</tr>
					</sf:form>
				</c:if>
				</table>				
			</div>
			<%@ include file="footer.jsp"%>
		</div>
	</div>

	<div id="right-column-outer">
		<div id="right-column"></div>
	</div>
</body>
</html>